<!DOCTYPE html>
<html>
<head>
    <title>物料计划系统</title>

    <meta name="keywords" content="物料计划系统"/>

    <meta name="description" content="物料计划系统"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <script type="application/x-javascript"> addEventListener("load", function () {
        setTimeout(hideURLbar, 0);
    }, false);

    function hideURLbar() {
        window.scrollTo(0, 1);
    } </script>
    <!-- Custom Theme files -->
    <link href="../static/css/login.css" rel="stylesheet" type="text/css" media="all"/>
    <script src="../static/jquery-3.6.3.min.js"></script>
    <link rel="stylesheet" href="../static/Layui_V2.5.6/layui/dist/css/layui.css">
    <script src="../static/layui/layui.js"></script>
    <!-- //Custom Theme files -->
</head>
<body>
<!-- main -->
<div class="main">
    <h1>Material Plan</h1>
    <div class="login-form">
        <h2>SignIn Form</h2>
        <div class="agileits-top">
            <form action="#" method="post">
                <div class="styled-input">
                    <input type="text" id="uname" name="User Name" required=""/>
                    <label>User Name</label>
                    <span></span>
                </div>
                <div class="styled-input">
                    <input type="password" id="pwd" name="Password" required="">
                    <label>Password</label>
                    <span></span>
                </div>
<!--                <div class="wthree-text">-->
<!--                    <ul>-->
<!--                        <li>-->
<!--                            <input type="checkbox" id="brand">-->
<!--                            <label for="brand"><span></span> Remember me ?</label>-->
<!--                        </li>-->
<!--                        <li><a href="#">Forgot password?</a></li>-->
<!--                    </ul>-->
<!--                    <div class="clear"></div>-->
<!--                </div>-->
            </form>
        </div>
        <div class="agileits-bottom">
            <form action="#" method="post">
                <input type="button" value="Sign In" id="loginBtn">
            </form>
        </div>
    </div>
</div>
<!-- //main -->
<!-- copyright -->
<div class="copyright">
    <p> © 2024 Badge Sign In Form . All rights reserved | Design by </p>
</div>
<script>
    layui.use(["jquery", "layer"], function () {

        let href = window.location.href
        let frame = parent.document.getElementById("frame")
        if (frame !== undefined) {
            let src = $(frame).attr("src")
            if (src !== undefined && src !== "") {
                if (href.toString().includes("login") && !src.toString().includes("login")) {
                    window.parent.location.reload()
                }
            }
        }


        let layer = layui.layer;
        $("#loginBtn").click(function () {
            let uname = $("#uname").val()
            let pwd = $("#pwd").val()
            $.post("/login", {
                uname,
                pwd
            }, function (res) {
                if (res.code === 200) {
                    layer.msg(res.msg, {icon: 6, time: 1000}, function () {
                        window.location.href = "/"
                    })
                } else {
                    layer.msg(res.msg, {icon: 2, time: 2000}, function () {

                    })
                }
            })
        })
    })
</script>
<!-- //copyright -->
</body>
</html>